home *** CD-ROM | disk | FTP | other *** search
- ;---------------------------------------------------------
- ; This design decodes a 4-bit number into 7 signals which
- ; can drive a 7-segment LED digit. The LEDs in the digit
- ; should light in a pattern that represents the number.
- ;---------------------------------------------------------
- TITLE 7-segment led decoder
-
- ;*-- beginning of LED decoder module ---------------------
- DEFMOD leddigit( d0,d1,d2,d3,s0,s1,s2,s3,s4,s5,s6)
- CHIP leddigit Intel_arch
-
- PIN d[3:0] ; 4-bit input to the LED decoder
- PIN s[6:0] ; 7-bit output to the LED digit
-
- ;---------------------------------------------------------
- ; Below is the truth table for driving the LEDs given the
- ; 4-bit number. A 1 on an output will make the
- ; corresponding LED segment light up; a 0 will make the
- ; segment stay dark. The truth-table gives the appropriate
- ; outputs to light the LED segments for the digits 0--F.
- ;---------------------------------------------------------
- T_TAB ( d3 d2 d1 d0 >> s0 s1 s2 s3 s4 s5 s6 )
- 0 0 0 0 : 1 1 1 0 1 1 1 ;* 0
- 0 0 0 1 : 0 1 0 0 1 0 0 ;* 1
- 0 0 1 0 : 1 0 1 1 1 0 1 ;* 2
- 0 0 1 1 : 1 1 0 1 1 0 1 ;* 3
- 0 1 0 0 : 0 1 0 1 1 1 0 ;* 4
- 0 1 0 1 : 1 1 0 1 0 1 1 ;* 5
- 0 1 1 0 : 1 1 1 1 0 1 1 ;* 6
- 0 1 1 1 : 0 1 0 0 1 0 1 ;* 7
- 1 0 0 0 : 1 1 1 1 1 1 1 ;* 8
- 1 0 0 1 : 1 1 0 1 1 1 1 ;* 9
- 1 0 1 0 : 0 1 1 1 1 1 1 ;* A
- 1 0 1 1 : 1 1 1 1 0 1 0 ;* b
- 1 1 0 0 : 1 0 1 0 0 1 1 ;* C
- 1 1 0 1 : 1 1 1 1 1 0 0 ;* d
- 1 1 1 0 : 1 0 1 1 0 1 1 ;* E
- 1 1 1 1 : 0 0 1 1 0 1 1 ;* F
- ENDMOD
- ;*-- end of LED decoder module ---------------------------
-
-
-
- CHIP test NFX780_84
-
- PIN [50:47] d[3:0]
- PIN 51 unused0
- PIN [77:78] unused[1:2]
- PIN [37:34] s[3:0]
- PIN [41:39] s[6:4]
- MODULE leddigit(d[3:0]=d[3:0],s[6:0]=s[6:0])
-
- SIMULATION
- VECTOR d := [d3,d2,d1,d0]
- FOR i := 0 TO 15 DO
- BEGIN
- SETF d := i
- END
-